package com.ls.fw.frame.api.model;

import com.ls.fw.data.annotation.FwColumn;
import com.ls.fw.data.annotation.FwTable;
import com.ls.fw.data.bean.BaseDataEntity;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.*;

@Table(name = "api_account")
@FwTable(name = "api_account",remark = "")
public class ApiAccount extends BaseDataEntity implements Serializable {
    /**
     * ID
     */
    @Id
    @FwColumn(name = "id",remark = "ID")
    @GeneratedValue(generator = "JDBC")
    private Long id;

    /**
     * 名称
     */
    @Column(name = "app_key")
    @FwColumn(name = "app_key",remark = "名称")
    private String appKey;

    /**
     * 密码
     */
    @Column(name = "app_secret")
    @FwColumn(name = "app_secret",remark = "密码")
    private String appSecret;

    /**
     * 盐值
     */
    @FwColumn(name = "salt",remark = "盐值")
    private String salt;

    /**
     * 用户类型
     */
    @Column(name = "user_type")
    @FwColumn(name = "user_type",remark = "用户类型")
    private String userType;

    /**
     * 权限json串
     */
    @FwColumn(name = "roles",remark = "权限json串")
    private String roles;

    /**
     * 最后登陆时间
     */
    @Column(name = "login_dt")
    @FwColumn(name = "login_dt",remark = "最后登陆时间")
    private String loginDt;

    /**
     * 最后登陆IP
     */
    @Column(name = "login_ip")
    @FwColumn(name = "login_ip",remark = "最后登陆IP")
    private String loginIp;

    /**
     * 登陆次数
     */
    @Column(name = "login_times")
    @FwColumn(name = "login_times",remark = "登陆次数")
    private Integer loginTimes;

    private static final long serialVersionUID = 1L;

    /**
     * 获取ID
     *
     * @return id - ID
     */
    public Long getId() {
        return id;
    }

    /**
     * 设置ID
     *
     * @param id ID
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * 获取名称
     *
     * @return app_key - 名称
     */
    public String getAppKey() {
        return appKey;
    }

    /**
     * 设置名称
     *
     * @param appKey 名称
     */
    public void setAppKey(String appKey) {
        this.appKey = appKey == null ? null : appKey.trim();
    }

    /**
     * 获取密码
     *
     * @return app_secret - 密码
     */
    public String getAppSecret() {
        return appSecret;
    }

    /**
     * 设置密码
     *
     * @param appSecret 密码
     */
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret == null ? null : appSecret.trim();
    }

    /**
     * 获取盐值
     *
     * @return salt - 盐值
     */
    public String getSalt() {
        return salt;
    }

    /**
     * 设置盐值
     *
     * @param salt 盐值
     */
    public void setSalt(String salt) {
        this.salt = salt == null ? null : salt.trim();
    }

    /**
     * 获取用户类型
     *
     * @return user_type - 用户类型
     */
    public String getUserType() {
        return userType;
    }

    /**
     * 设置用户类型
     *
     * @param userType 用户类型
     */
    public void setUserType(String userType) {
        this.userType = userType == null ? null : userType.trim();
    }

    /**
     * 获取权限json串
     *
     * @return roles - 权限json串
     */
    public String getRoles() {
        return roles;
    }

    /**
     * 设置权限json串
     *
     * @param roles 权限json串
     */
    public void setRoles(String roles) {
        this.roles = roles == null ? null : roles.trim();
    }

    /**
     * 获取最后登陆时间
     *
     * @return login_dt - 最后登陆时间
     */
    public String getLoginDt() {
        return loginDt;
    }

    /**
     * 设置最后登陆时间
     *
     * @param loginDt 最后登陆时间
     */
    public void setLoginDt(String loginDt) {
        this.loginDt = loginDt == null ? null : loginDt.trim();
    }

    /**
     * 获取最后登陆IP
     *
     * @return login_ip - 最后登陆IP
     */
    public String getLoginIp() {
        return loginIp;
    }

    /**
     * 设置最后登陆IP
     *
     * @param loginIp 最后登陆IP
     */
    public void setLoginIp(String loginIp) {
        this.loginIp = loginIp == null ? null : loginIp.trim();
    }

    /**
     * 获取登陆次数
     *
     * @return login_times - 登陆次数
     */
    public Integer getLoginTimes() {
        return loginTimes;
    }

    /**
     * 设置登陆次数
     *
     * @param loginTimes 登陆次数
     */
    public void setLoginTimes(Integer loginTimes) {
        this.loginTimes = loginTimes;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ApiAccount other = (ApiAccount) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getAppKey() == null ? other.getAppKey() == null : this.getAppKey().equals(other.getAppKey()))
            && (this.getAppSecret() == null ? other.getAppSecret() == null : this.getAppSecret().equals(other.getAppSecret()))
            && (this.getSalt() == null ? other.getSalt() == null : this.getSalt().equals(other.getSalt()))
            && (this.getUserType() == null ? other.getUserType() == null : this.getUserType().equals(other.getUserType()))
            && (this.getRoles() == null ? other.getRoles() == null : this.getRoles().equals(other.getRoles()))
            && (this.getDeleteClass() == null ? other.getDeleteClass() == null : this.getDeleteClass().equals(other.getDeleteClass()))
            && (this.getValidClass() == null ? other.getValidClass() == null : this.getValidClass().equals(other.getValidClass()))
            && (this.getCreateUser() == null ? other.getCreateUser() == null : this.getCreateUser().equals(other.getCreateUser()))
            && (this.getCreateUserId() == null ? other.getCreateUserId() == null : this.getCreateUserId().equals(other.getCreateUserId()))
            && (this.getCreateDt() == null ? other.getCreateDt() == null : this.getCreateDt().equals(other.getCreateDt()))
            && (this.getModUser() == null ? other.getModUser() == null : this.getModUser().equals(other.getModUser()))
            && (this.getModUserId() == null ? other.getModUserId() == null : this.getModUserId().equals(other.getModUserId()))
            && (this.getModDt() == null ? other.getModDt() == null : this.getModDt().equals(other.getModDt()))
            && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
            && (this.getLoginDt() == null ? other.getLoginDt() == null : this.getLoginDt().equals(other.getLoginDt()))
            && (this.getLoginIp() == null ? other.getLoginIp() == null : this.getLoginIp().equals(other.getLoginIp()))
            && (this.getLoginTimes() == null ? other.getLoginTimes() == null : this.getLoginTimes().equals(other.getLoginTimes()))
            && (this.getUpdateTs() == null ? other.getUpdateTs() == null : this.getUpdateTs().equals(other.getUpdateTs()))
            && (this.getInsertTs() == null ? other.getInsertTs() == null : this.getInsertTs().equals(other.getInsertTs()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getAppKey() == null) ? 0 : getAppKey().hashCode());
        result = prime * result + ((getAppSecret() == null) ? 0 : getAppSecret().hashCode());
        result = prime * result + ((getSalt() == null) ? 0 : getSalt().hashCode());
        result = prime * result + ((getUserType() == null) ? 0 : getUserType().hashCode());
        result = prime * result + ((getRoles() == null) ? 0 : getRoles().hashCode());
        result = prime * result + ((getDeleteClass() == null) ? 0 : getDeleteClass().hashCode());
        result = prime * result + ((getValidClass() == null) ? 0 : getValidClass().hashCode());
        result = prime * result + ((getCreateUser() == null) ? 0 : getCreateUser().hashCode());
        result = prime * result + ((getCreateUserId() == null) ? 0 : getCreateUserId().hashCode());
        result = prime * result + ((getCreateDt() == null) ? 0 : getCreateDt().hashCode());
        result = prime * result + ((getModUser() == null) ? 0 : getModUser().hashCode());
        result = prime * result + ((getModUserId() == null) ? 0 : getModUserId().hashCode());
        result = prime * result + ((getModDt() == null) ? 0 : getModDt().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getLoginDt() == null) ? 0 : getLoginDt().hashCode());
        result = prime * result + ((getLoginIp() == null) ? 0 : getLoginIp().hashCode());
        result = prime * result + ((getLoginTimes() == null) ? 0 : getLoginTimes().hashCode());
        result = prime * result + ((getUpdateTs() == null) ? 0 : getUpdateTs().hashCode());
        result = prime * result + ((getInsertTs() == null) ? 0 : getInsertTs().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(","+super.toString());
        sb.append(", id=").append(id);
        sb.append(", appKey=").append(appKey);
        sb.append(", appSecret=").append(appSecret);
        sb.append(", salt=").append(salt);
        sb.append(", userType=").append(userType);
        sb.append(", roles=").append(roles);
        sb.append(", loginDt=").append(loginDt);
        sb.append(", loginIp=").append(loginIp);
        sb.append(", loginTimes=").append(loginTimes);
        sb.append("]");
        return sb.toString();
    }

    /*************数据库列名start***********/
    /*************数据库列名end***********/
    public static final class Columns {
        /**
         * 字段名称映射<数据库字段名,属性名>
         */
        public static final Map<String, String> FIELD_MAP =  new HashMap<String,String>();

        /**
         * ID
         */
        public static final String id_NAME = "id";

        /**
         * 主键名称
         */
        public static final String PK_NAME = "id";

        /**
         * 名称
         */
        public static final String appKey_NAME = "app_key";

        /**
         * 密码
         */
        public static final String appSecret_NAME = "app_secret";

        /**
         * 盐值
         */
        public static final String salt_NAME = "salt";

        /**
         * 用户类型
         */
        public static final String userType_NAME = "user_type";

        /**
         * 权限json串
         */
        public static final String roles_NAME = "roles";

        /**
         * 删除区分
         */
        public static final String deleteClass_NAME = "delete_class";

        /**
         * 有效区分
         */
        public static final String validClass_NAME = "valid_class";

        /**
         * 创建人
         */
        public static final String createUser_NAME = "create_user";

        /**
         * 创建人ID
         */
        public static final String createUserId_NAME = "create_user_id";

        /**
         * 创建时间
         */
        public static final String createDt_NAME = "create_dt";

        /**
         * 修改人
         */
        public static final String modUser_NAME = "mod_user";

        /**
         * 修改人ID
         */
        public static final String modUserId_NAME = "mod_user_id";

        /**
         * 修改时间
         */
        public static final String modDt_NAME = "mod_dt";

        /**
         * 备注
         */
        public static final String remark_NAME = "remark";

        /**
         * 最后登陆时间
         */
        public static final String loginDt_NAME = "login_dt";

        /**
         * 最后登陆IP
         */
        public static final String loginIp_NAME = "login_ip";

        /**
         * 登陆次数
         */
        public static final String loginTimes_NAME = "login_times";

        public static final String updateTs_NAME = "update_ts";

        /**
         * 时间戳
         */
        public static final String insertTs_NAME = "insert_ts";

        static {
            FIELD_MAP.put("id","id");
            FIELD_MAP.put("app_key","appKey");
            FIELD_MAP.put("app_secret","appSecret");
            FIELD_MAP.put("salt","salt");
            FIELD_MAP.put("user_type","userType");
            FIELD_MAP.put("roles","roles");
            FIELD_MAP.put("delete_class","deleteClass");
            FIELD_MAP.put("valid_class","validClass");
            FIELD_MAP.put("create_user","createUser");
            FIELD_MAP.put("create_user_id","createUserId");
            FIELD_MAP.put("create_dt","createDt");
            FIELD_MAP.put("mod_user","modUser");
            FIELD_MAP.put("mod_user_id","modUserId");
            FIELD_MAP.put("mod_dt","modDt");
            FIELD_MAP.put("remark","remark");
            FIELD_MAP.put("login_dt","loginDt");
            FIELD_MAP.put("login_ip","loginIp");
            FIELD_MAP.put("login_times","loginTimes");
            FIELD_MAP.put("update_ts","updateTs");
            FIELD_MAP.put("insert_ts","insertTs");
        }
    }
}